#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include<QMediaPlayer>
#include<QMediaPlaylist>
#include<QListWidgetItem>
#include<QMessageBox>
#include"mysqlconnect.h"
#include"music.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_quit_button_clicked();

    void on_minimize_but_clicked();

    void on_sound_button_clicked();

    //void SetPlaylist();
    void on_cur_button_clicked();

    void on_like_button_clicked();

    void on_local_button_clicked();

    void on_play_button_clicked();

    void on_cur_list_itemClicked(QListWidgetItem *item);

    void on_down_but_clicked();

    void on_sound_slider_sliderMoved(int position);

    void on_next_button_clicked();

    void on_pre_button_clicked();

    void on_play_but_clicked();

    void on_home_but_clicked();

    void on_search_button_clicked();

    void on_search_widget_itemClicked(QListWidgetItem *item);

    void on_progress_sliderMoved(int position);

    void change_process(qint64 t);

    //void on_like_but_clicked();

private:
    Ui::MainWindow *ui;

    MySqlConnect *db;
    //当前播放器
    QMediaPlayer *player;
    //当前播放列表
    QMediaPlaylist *playlist;

    //播放列表
    QVector<Music> curlist;

    QVector<Music>historylist;

    QVector<Music>lovelist;

    QVector<Music>locallist;

    //本地音乐下载地址
    QUrl localurl;

    void init_historylist();//初始化播放列表
    void refresh_playlist();//更新playlist
    void playmusic();
};
#endif // MAINWINDOW_H
